import {Component, Input, OnInit} from '@angular/core';
import {ThemeService} from '../../services/theme.service';
import {interval, timer} from 'rxjs';

@Component({
  selector: 'app-theme',
  templateUrl: './theme.component.html',
  styleUrls: ['./theme.component.scss']
})
export class ThemeComponent implements OnInit {
  @Input() size = '10px';

  currentIndex = 0;

  constructor(public theme: ThemeService) {
  }

  ngOnInit() {
    this.currentIndex = this.theme.colors.indexOf(this.theme.color);
  }

  changeThemeColor(color, i) {
    this.currentIndex = i;
    localStorage.setItem('themeColor', color.name);
    this.theme.color = color;
  }

}
